package com.zmj.sy.mom.srv.aps.mapper;

import com.zmj.sy.mom.srv.aps.bean.entity.mes.PartPallet;
import com.zmj.sy.mom.srv.aps.bean.vo.orderMonitor.OrderMonitorPalletResVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PartPalletMapper extends SyMapper<PartPallet> {

    @Delete("delete from tb_mes_part_pallet where id = #{id} ")
    void deleteReal(@Param("id") Integer id);

    @Select("SELECT pp.plm_id AS materNo, pp.phase_code AS phase, pp.part_count AS count, pp.loading_code AS palletNo, pp.position_code AS position " +
            "FROM tb_aps_work_detail awd LEFT JOIN tb_mes_part_pallet pp ON awd.mater_no = pp.plm_id " +
            "WHERE pp.id IS NOT NULL  AND awd.id = #{id} " +
            "ORDER BY awd.phase_seq ")
    List<OrderMonitorPalletResVo> selectPalletInfo(@Param("id") Integer id);

}
